package cn.njxzc.examples;

import java.io.FileInputStream;
import java.io.IOException;

public class Exam9_12 {
	public static void main(String[] args) throws IOException {
		long t = System.currentTimeMillis();
		String filename = args[0];
		FileInputStream fis = new FileInputStream(filename);
		int count = 0;
		final int BUFSIZE = 1024;
		byte[] buf = new byte[BUFSIZE];
		int len;
		while ((len = fis.read(buf)) != -1) {
			for (int i = 0; i < len; i++) {
				if (buf[i] == 'A') {
					count++;
				}
			}
		}
		fis.close();
		System.out.println(count);
		t = System.currentTimeMillis() - t;
		System.out.println("Time elapsed:" + t);
	}
}
